# -*-coding: Utf-8 -*-
# @File : RedisConnect .py
# author: Chimengmeng
# blog_url : https://www.cnblogs.com/dream-ze/
# Time：2023/10/7
from . import settings
from .redis_pool import POOL
import redis


# 创建Redis链接对象
class RedisController():
    def __init__(self):
        # 普通 Redis 链接对象
        self.redis_conn = redis.Redis(
            host=settings.HOST,
            port=settings.PORT,
            db=settings.DB,
            password=settings.PASSWORD,
            decode_responses=settings.DECODE_RESPONSES,
        )
        # Redis 链接池（单例模式）
        self.redis_pool = redis.Redis(connection_pool=POOL)
